<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Commission extends Model
{
    protected $table="commission";
    use HasFactory;
    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * 团长信息
     */
    public function comWithHead(){
        return $this->belongsTo(StoreHead::class,"hid","uid");
    }
    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     * 团长佣金
     */
    public function comWithOrder(){
        return $this->belongsTo(StoreOrder::class,"sid","id");
    }

    /**
     * @param $sid
     * @param $data
     * @return mixed
     * 修改佣金
     */
    public function updataCommission($sid,$data){
        return $this->where("sid",$sid)->update(['incomeission'=>$data]);
    }
}
